import numpy as np
import base64
import requests
import time

images = np.load(r'D:\face_0.pkg', allow_pickle=True)
print(len(images))

url = 'http://192.168.1.160:21100/face/v1/face_image_flow'
camera_id = 186

gIndex = 0
for image in images:
	gIndex += 1
	if gIndex < 0:
		continue
	# t = image['face_id'][:19]
	# t = time.strptime(t, "%Y_%m_%d_%H_%M_%S")
	# t = time.mktime(t)
	print(gIndex)
	face_image_content_base64 = base64.b64encode(image['bytes']).decode()

	data = {
		"face_image_content_base64": face_image_content_base64,
		"timestamp": int(time.time()),
		"camera_id": camera_id
	}
	print(requests.post(url=url, json=data).text[:])
	time.sleep(1)
	if gIndex > 10000:
		break
